<?php
/**
 * main
 */
include LIB_PATH . '/YAction.class.php';
class MainAction extends YAction {
	private $menu = array();  // 菜单
	
	public function __construct() {
		parent::__construct();
		
		// 登录检测
		if(!$this->isLogin()) {
			echo '_error Access Timeout'; exit;
		}
		
		$this->menu = SysUtil::loadConfig('menu.php', CONF_PATH);
	}
	
	public function index() {
		$this->assign('menu', $this->menu);
		$this->assign('selfTitle', '后台管理');
		
		$this->display();
	}
	
	public function main() {
		
		$this->display();
	}
	
	public function ajax_getMenu() {
		$m = y_getParam('m');
		
		if(isset($this->menu['submenu'][$m])) {
			echo json_encode($this->menu['submenu'][$m]);
			exit;
		}
		
		echo '{}';
	}
	
}

